<template>
	<view class="coincord">
		<view class="coinmain">
			<view class="bg-white px15 cointop">
				<view class="f14 color-number">{{coinTxt}}余额</view>
				<view class="mt8"><text class="f33 fwb">426</text> <text class="f14 ml4">{{coinTxt}}</text></view>
				<view class="f14 color-number mt2">≈ $ 588.633</view>
			</view>
			<view class="mt8">
				<view v-if="coinList.length==0&&!loadingMore" class="mt50">
					<image src="../../static/user/nodata.png" class="nodata"></image>
					<view class="text--center notxt">暂无流水数据</view>
				</view>
				<view class="mt10 bg-white px15 pb30" v-else>
					<view class="por color21 fwb fundtitle f14 pt15 px5 mb5">资产流水明细</view>
					<view v-for="(citem,cindex) in coinList" :key="citem.id" class="py12 fcc flex-justify-between border1">
						<view>
							<view class="f15">{{citem.opt_type}}</view>
							<view class="f13 color-number mt2">{{citem.add_time_time}}</view>
						</view>
						<view class="text--right">
							<view class="fwb f16" :class="citem.num.indexOf('+')>=0?'jiaColor':''">{{citem.num.indexOf('+')>=0?citem.num:''+citem.num}}</view>
							<!-- <view class="f12 mt2 colored">审核中</view> -->
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="cu-load f12 color-info" :class="loadingMore ? 'loading' : 'over'" v-if="coinList.length>10">{{ loadingMore ? '加载中...' : '没有更多了' }}</view>
	</view>
	<!-- 闪兑 -->
</template>

<script>
	export default {
		data() {
			return {
				exchange:{},
				cointype:0,
				coinArr:['USDT-ERC20','STD','ETH','BTC','STD-ERC20'],
				coinTxt:'',
				coinList:[{opt_type:'转账',add_time_time:'2020.09.29 15:04:51',num:'+25.00000'},
				{opt_type:'转账',add_time_time:'2020.09.29 15:04:51',num:'25.00000'}
				]
				
			}
		},
		onLoad(options) {
			this.cointype = options.type
			this.coinTxt = this.coinArr[options.type]
		},
		computed: {
			getnumber:function(){
				let result = 0
				let { accAdd } = this.$utils.num
				if(Object.keys(this.exchange).length>0){
					result = accAdd(this.exchange.total_snkpledge,this.exchange.snkmedium_shot)
				}
				return result
			},
			accNumber:function(){
				let results = 0
				let { accSub } = this.$utils.num
				if(Object.keys(this.exchange).length>0){
					results = accSub(this.exchange.snktotal_medium_shot,this.exchange.snkmedium_shot)
				}
				return results
			}
		},
		onShow() {
			// this.clearData()
			// this.getData()
		},
		onReachBottom() {
			this.getData()
		},
		methods:{
			// getbounber(number,n){
			// 	return toFixedDigit(number,n)
			// },
			async getData(){
				if (this.finish) return
				let { data } = await this.$http.post('exchange.coinFlutter', {m:this.page,n:10,fund_type:Number(this.cointype)+1}, {isAuth:true, tipConfig: { isLoading: false } })
				this.finish = data.length < 10
				!this.finish && (this.page += 1)
				this.coinList = [...this.coinList, ...data]
			},
			clearData(){
				this.page = 1
				this.finish = false
				this.coinList = []
			}
		}
	}
</script>

<style lang="less">
	.coincord{
		min-height: 100vh;
		background-color: #F6F5F9;
		letter-spacing: 0;
		.border1{
			border-bottom: 2rpx solid #E5E5E5;
		}
		.colored{
			color: #FF444C;
		}
		.fundtitle::before{
			content: '';
			width: 8rpx;
			height: 32rpx;
			background-color: #308ae4;
			position: absolute;
			left: -10rpx;
			top:32rpx
		}
	
		.color-number{
			color:#8D8D93
		}
		.color21{
			color: #212121;
		}
		.jiaColor{
			color: #FF7F12;
		}
		.coinmain{
			.cointop{
				padding-top: 44rpx;
				padding-bottom: 30rpx;
			}
		}
	}
</style>
